﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QuanLyThietBi.DAL.Models;
using QuanLyThietBi.DAL;


namespace QuanLyThietBi.BLL
{
    public class TinhTrangBO
    {
        public List<TINHTRANG> GetAllTinhTrang() 
        {
            TinhTrangDAO tinhtrangs = new TinhTrangDAO();
            return tinhtrangs.GetAllTinhTrang();
        }

        public string GetTinhTrangById(int tinhtrangId)
        {
            TinhTrangDAO ttDAO = new TinhTrangDAO();
            return ttDAO.GetTinhTrangById(tinhtrangId);
        }

        public string GetTenTinhTrang(int thietbiId)
        {
            ThietBiDAO tbDAO = new ThietBiDAO();
            string tinhtrang = string.Empty;
            THIETBI thietbi = tbDAO.GetThietBiById(thietbiId);
            if (thietbi != null)
            {
                TinhTrangDAO ttDAO = new TinhTrangDAO();
                tinhtrang = ttDAO.GetTinhTrangById(thietbi.tinh_trang);
            }
            return tinhtrang;
        }
    }
}
